#include<bits/stdc++.h>
using namespace std;
int a[100010] = {0};
int b[100010] = {0};
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n,cnt1 = 0,cnt2 = 0;
    cin >> n;
    for(int i =0;i < n;i++){
        cin >> a[i];
        if(a[i] == 1)  cnt1++;
        else if(a[i] == 2)  cnt2++;
        b[i] = a[i];
    }
    if(cnt1 + cnt2 == n)
    {
        cout << n - min(cnt1,cnt2);
        return 0;
    }
    int ans = n;
    sort(a,a+n);
    sort(b,b+n);
    for(int i = 0;i < n-1;i++){
        for(int j = i+1;j < n;j++){
            if(b[j] > a[i]){
                a[i] = 0;
                b[j] = 0;
                ans--;
                break;
            }
        }
    }
    cout << ans;
    return 0;
}
